import request from '@/utils/request'
import { tansParams } from '@/utils/index'

export function login(params) {
  return request({
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    url: 'auth/login',
    method: 'post',
    data: params,
    transformRequest: [(data) => {
      return tansParams(data)
    }]
  })
}

export function getInfo() {
  return request({
    url: 'api/userInfo',
    method: 'get'
  })
}

export function getCodeImg(params) {
  return request({
    url: 'auth/captcha/graph',
    method: 'get',
    data: params

  })
}

export function reqCheck(params) {
  return request({
    url: 'auth/captcha/check',
    method: 'post',
    data: params
  })
}

export function logout() {
  return request({
    url: 'auth/logout',
    method: 'delete'
  })
}
